<%@page import="com.User1"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="org.hibernate.Query"%>
<%@page import="org.hibernate.Transaction"%>
<%@page import="org.hibernate.Session"%>
<%@page import="org.hibernate.SessionFactory"%>
<%@page import="org.hibernate.cfg.Configuration"%>
<table border="2">
<tr>
<td style="font-weight: bold;" width="123" >UID</td>
<td style="font-weight: bold;"width="153">NAME</td>
<td style="font-weight: bold;" width="153">USERNAME</td>
<td style="font-weight: bold;" width="123">PASSWORD</td>
</tr>
<%
Configuration cfg=new Configuration();
cfg.configure();
SessionFactory sf=cfg.buildSessionFactory();
Session ses=sf.openSession();
Transaction tx=ses.beginTransaction();
Query query=ses.createQuery("from User1");
ArrayList ar=(ArrayList)query.list();
Iterator it=ar.iterator();
while(it.hasNext()){
User1 us=(User1)it.next();
%>

<tr>
<td width="123"><%=us.getPid()%></td>
<td width="153"><%=us.getName()%></td>
<td width="133"><%=us.getUname()%></td>
<td width="123"><%=us.getPassword()%></td>
</tr>


<%
}
tx.commit();
ses.close();


%>
</table>